package leetcode.code881.BoatstoSavePeople;

import java.util.Arrays;

public class Solution88102 extends BoatstoSavePeople {

	@Override
	public int numRescueBoats(int[] people, int limit) {
		Arrays.sort(people);
		int lp = 0;
		int rp = people.length - 1;
		int count = 0;
		while (lp <= rp) {
			if (people[lp] + people[rp] <= limit) {
				lp++;
			}
			count++;
			rp--;
		}
		return count;
	}

	public static void main(String[] args) {
		Solution88102 so = new Solution88102();
		so.debug1();
		so.debug2();
		so.debug3();

//		int[] array = new int[] { 6, 4, 2, 7, 9, 1, 0 };
//		so.mergeSort(array, 0, array.length - 1);
//		HelpDebug.printObject(array);
	}

}
